<?php
/**
 *
 * @author liumingl
 * @version 
 */
require_once 'Zend/View/Interface.php';

/**
 * BaseUrl helper
 *
 * @uses viewHelper Zend_View_Helper
 */
class Zend_View_Helper_BaseUrl extends Zend_View_Helper_Abstract{
	
	/**
	 * @var Zend_View_Interface 
	 */
	public $view;
	
	/**
	 *  
	 */
	public function baseUrl($file = null)  {
		$settings = Zend_Registry::get('settings');
		
		// Get baseUrl 
        //$baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();
        $baseUrl = $settings->production->settings->siteurl; 
 
        // Remove trailing slashes 
        $file = ($file !== null) ? ltrim($file, '/\\') : null; 
 
        // Build return 
        $return = rtrim($baseUrl, '/\\') . (($file !== null) ? ('/' . $file) : ''); 
 
        return $return; 
	}
	
	/**
	 * Sets the view field 
	 * @param $view Zend_View_Interface
	 */
	public function setView(Zend_View_Interface $view) {
		$this->view = $view;
	}
}

